﻿CREATE proc [dbo].[Spm_UserLogin]
@account nvarchar(50)='',
@pwd nvarchar(50)=''
as
declare @islocked int
select @islocked=islocked from UserInfo where account=@account and password=@pwd;
if(@islocked=1)
	return 2;--已被登录
if exists(select 1 from UserInfo where account=@account and password=@pwd)
begin
	update UserInfo set islocked=1 where  account=@account and password=@pwd;
	select * from UserInfo where account=@account and password=@pwd
	return 0;--登录成功
end
else
begin
	return 1;--登录失败
end